// import {pathToBase64} from ''
// const pathToBase64=require('../secondHandTrade/mmmm-image-tools_1.4.0/index');
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    if (wx.getStorageSync('cartList')) {
      this.globalData.cartList = wx.getStorageSync('cartList')
    }

    // 登录
    wx.login({
      success: res => {
        console.log(res);
        this.globalData.openid=res.code;
        console.log(this.globalData.openid);
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },

  globalData: {
    userInfo: null,
    baseurl: 'http://localhost:5050/',
    openid: '', // 用户的唯一标识
    avatarUrl: '', // 用户头像地址
    campus_announcement: [],
    //购物车列表
    cartList: [],
    // 订单列表
    orderList:null,
    // 订单总额
    sumPrice:0,
    // 总数量
    numTotal:0
  }
})
